<?php 
	//---  获得post数据  ---
	$find = $_REQUEST['FindUserID'];
	$userID = $_REQUEST['UserID'];
	//－－－  连接服务器  －－－
	$con = mysql_connect("127.0.0.1:3306","root","1qazse4");
	$DataName = 'ShareNavigation';
	if(!$con)
	{
		die('无法连接远程服务器: '.mysql_error);
	}
	//－－－  链接指定数据库  －－－
	mysql_query("SET NAMES UTF8");
	mysql_select_db($DataName,$con);
	//---  查找相似的用户  ---
	$query = "SELECT * FROM User WHERE UserID LIKE \"%$find%\"";
	$result = mysql_query($query);
	//－－－  准备过滤已经是好友的用户  －－－
	$query = "SELECT * FROM Friend WHERE UserID = \"$userID\" && IsAccept = 1";
	$result1 = mysql_query($query);
	$i = 0;
	while ($row1 = mysql_fetch_array($result1))
	{
	   $temp[$i++] = $row1['FriendID'];
	}
	$cnt = $i;
	$k = 0;
	if(!$result)
	{
		//---  查询出错   ----
		die('FALSE');
	}
	else 
	{
		echo '<body>' ;
		while($row = mysql_fetch_array($result))
  		{
  			//---  如果已经在添加好友的列表里，就不出现  ---
  			//echo '<temp>';
  			for($i = 0; $i < $cnt;$i++)
			{
				if($temp[$i] == $row['UserID'] )
				{
					$k = 1;
				}
			}
			if($row['UserID'] == $userID)
			{
				$k = 1;
			}
			//echo '<\temp>';
			if($k == 0)
			{
				echo '<OneFriend>';
				echo '<UserID>' .$row['UserID'].'</UserID>';
				echo '<HeadPhoto>' . $row['HeadPhoto'] . '</HeadPhoto>';
				echo '</OneFriend>';
			}
			$k = 0; 
 		}
		echo '</body>'; 	
	}
	
	mysql_close($con);
?>